from flask import Flask, request, redirect, render_template, session,url_for
"""
endpoint 默认是函数名字
"""
# url_for 反向生成
app = Flask(__name__)
app.secret_key = 'niedoqebowoefweihiowefihwf'


@app.route('/', methods=['GET'])
def asd():
    return redirect('/login')


@app.route('/login', methods=['GET', 'POST'],endpoint='n1')
def login():
    v1 = url_for('n1')
    v2 = url_for('n2')
    v3 = url_for('n3')
    # v1,v2,v3就是n1,n2,n3代表的url
    print(v1,v2,v3)
    return "login"


@app.route('/index', methods=['GET'],endpoint='n2')
def index():
    return "index"

@app.route('/logout', methods=['GET'],endpoint='n3')
def logout():
    return "logout"


if __name__ == '__main__':
    app.run(debug=True)